#!/usr/bin/env python
# -*- coding: utf-8 -*-

#from binance.client import BaseClient 注释方法使用

from decimal import Decimal


class BinanceUtils(object):


    """
        计算k线周期
    """
    # def kline_interval(interval):
    #     interval_time = BaseClient.KLINE_INTERVAL_30MINUTE
    #     if interval == '15min':
    #     interval_time = BaseClient.KLINE_INTERVAL_15MINUTE
    #     elif interval == '30min':
    #     interval_time = BaseClient.KLINE_INTERVAL_30MINUTE
    #     elif interval == '1h':
    #     interval_time = BaseClient.KLINE_INTERVAL_1HOUR
    #     else :
    #     interval_time = BaseClient.KLINE_INTERVAL_30MINUTE
    #     return interval_time



    """
        Round price to price tick value.
    """
    def round_to(value: float, target: float) -> float:
        value = Decimal(str(value))
        target = Decimal(str(target))
        rounded = float(int(round(value / target)) * target)
        return rounded